#ifndef __BRIDGE_MESSAGE_HXX__
#define __BRIDGE_MESSAGE_HXX__

#include <mytypes.h>
#include <was_api.h>
#include <safeque.hxx>

#ifdef WIN32

/* DLL export */
#ifdef EXPORT
#undef EXPORT
#endif

#ifdef EXPORT_BRIDGENET

#define EXPORT __declspec(dllexport)
#else
/* EXE import */
#define EXPORT __declspec(dllimport)
//#define EXPORT
#endif

#else
#define EXPORT 
#endif

#define HEADERSIZE	24
#define	TAILSIZE	4

typedef struct EXPORT tagBridgeMsg
{
    string GetData(E_WAS_TAG_ID tag) const;

	/** For Udp to determine the remote endpoint.*/
	string rhost;
	tUInt32 rport;

	tInt32	mpi;
	tInt32	tom;
	tInt32	tid;
	tInt32	rspc;
	tInt32	lom;
	tByte*	msg;

    bool isReceived;
}tBridgeMsg;
typedef SafeQue<tBridgeMsg*> tBridgeMsgQue;
typedef tByte* tAppMsg;

EXPORT tBridgeMsg* CreateBMsg(void);
EXPORT void ReleaseBMsg(tBridgeMsg* msg);

/** Create a copy of the msg */
EXPORT tBridgeMsg* DupBMsg(const tBridgeMsg* msg);

EXPORT tChar* GetDataFromMsg(tBridgeMsg* msg,E_WAS_TAG_ID tag_id);
EXPORT void ReleaseDataFromMsg(tChar* pdata);

EXPORT tUInt32 GetATid(void);
EXPORT tUInt32 GetAMpi(void);

#endif
